#include <iostream>

using namespace std;
typedef long long ll;

int N;

/*
 * 相当于模仿二进制进行计算: x x^2 x^4 x^8 ...
 *
*/
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

/* x^n = (x^2)^(n / 2) */
ll mod_pow_(ll x, ll n, ll mod) {
    if (n == 0) return 1;
    ll res = mod_pow_(x * x % mod, n / 2, mod);
    if (n & 1) res = res * x % mod;
    return res;
}


